<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>网址书签管理</title>
<?php include(DEDEMEMBER."/templets/head_inc.htm"); ?>
<script type="text/javascript" language='javascript'src='js/main.js'></script>
<script type="text/javascript" language="javascript">
<!--
var reMethod = "<?php echo ($cfg_soft_lang == 'utf-8') ? 'POST' : 'GET';?>";
//增加链接
function AddnewLink(){
	var taget_obj = $Obj('linkList');
	var linktype,getquery;
	getquery = "";

	if($Obj('title').value==''){
		alert('链接标题不能为空！');
		return false;
	}
	getquery += "&title="+$Obj('title').value;

	if($Obj('url').value==''){
		alert('链接网址不能为空！');
		return false;
	}
	getquery += "&url="+$Obj('url').value;
	getquery += "&tid="+$Obj('tid').value;
	getquery += "&fcontent="+$Obj('fcontent').value;
	
	$("#linkList").html("正在处理..！<br>[<a href='javascript:ReLoadList(0)'><u>重新加载列表</u></a>.");
	$.ajax({
		type: reMethod,
		url: "flink_main.php",
		data: "dopost=addnew"+getquery,
		dataType: 'html',
		success: function(result)
		{
			$("#linkList").html(result);
		}
	}); 
}

//更新类目
function UpdateType(tid){
	var taget_obj = $Obj('linkList');
	var linktype,getquery;
	getquery = "";
	if($Obj('title'+tid).value==''){
		alert('链接标题不能为空！');
		return false;
	}
	getquery += "&title="+$Obj('title'+tid).value;

	if($Obj('url'+tid).value==''){
		alert('链接网址不能为空！');
		return false;
	}
	//getquery += "&url="+$Obj('url'+tid).value;
	//getquery += "&url="+$Obj('url'+tid).value;
	
	$("#linkList").html("正在处理..！<br>[<a href='javascript:ReLoadList(0)'><u>重新加载列表</u></a>.");
	
	$.ajax({
		type: reMethod,
		url: "flink_main.php",
		data: "dopost=update&aid="+tid+getquery,
		dataType: 'html',
		success: function(result)
		{
			$("#linkList").html(result);
		}
	}); 
}

//删除链接
function DelType(tid){
	var taget_obj = $Obj('linkList');
	var titlename = $Obj('title'+tid).value;
	if(!window.confirm('你确定要删除链接：'+titlename+' 吗？')){ return false; }
	$("#linkList").html("正在处理..！<br>[<a href='javascript:ReLoadList(0)'><u>重新加载列表</u></a>.");
	$.ajax({
		type: reMethod,
		url: "flink_main.php",
		data: "dopost=del&aid="+tid,
		dataType: 'html',
		success: function(result)
		{
			$("#linkList").html(result);
		}
	}); 
}

//重载类目
function ReLoadList(oby){
	var taget_obj = $Obj('typeList');
	$.ajax({
		type: reMethod,
		url: "flink_main.php",
		data: "dopost=reload",
		dataType: 'html',
		success: function(result)
		{
			$("#linkList").html(result);
		}
	}); 
}
-->
</script>
</head>
<body>
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
<div class="wrapper lineT">
  <div class="mainBox">
    <div class="main">
      <?php include(DEDEMEMBER."/templets/menu.php"); ?>
      <div class="dedeMain">
        <div class="location">网址书签管理 <a href="mtypes.php">分类管理</a></div>
        <div class="titleTabBar bgGreen lineTB">
          <ul>            
            <li class="select"><a href="flink_main.php">所有分类</a></li>
            <?php 
         
           foreach($mtypearr as $k=>$v)
		  {
              echo "<li><a href='?tid=".$v['mtypeid']."'>".$v['mtypename']."</a></li>"; 
			}
      
            ?>          
          </ul>
        </div>
        <script type="text/javascript" src="js/table_function.js"></script>
        <div class="mTB10 mL10 mR10">
          <table cellspacing="1" class="submit">
            <tbody>
              <tr>
                <td width="15%" align="right" valign="top">链接名称：</td>
                <td><input name="title" type="text" id="title" class="text" style="width:170px;" />
                网址：<input name="url" type="text" id="url" class="text" value="http://" />
      记事：<input name="fcontent" type="text" id="fcontent" value="" />          
                分类：<input name="tid" type="text" id="tid" size="4" value="<?php echo $tid ?>" />
                 </td>
              </tr>
              <tr>
                <td align="right" valign="top">操作：</td>
                <td> <button class="button2" type="submit" onclick='AddnewLink()'>增加</button></td>
              </tr>
            </tbody>
          </table>
          
          <div class="titleBar bgGrass lineB mB10"><strong class="mL10">列表</strong></div>
          <div id="linkList">
            <?php GetLinkList($dsql);?>         
	  
          </div>          
        </div>
      </div>
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
</div>
<?php include(DEDEMEMBER."/templets/foot.htm"); ?>
</div>
</body>
</html>
